CC = gcc
CXX = g++

INCLUDES_DIR = -I. -I./Test
VPATH = .:./Test

TOTOLIB_DEBUG_OPTIONS = -D_TOTO_DEBUG

CXXFLAGS = $(TOTOLIB_DEBUG_OPTIONS) -g $(INCLUDES_DIR) -Wall
CXXLFLAGS = $(TOTOLIB_DEBUG_OPTIONS) -Wall -lz -lpthread

OBJS = CSyncThread.o CVerifyThread.o CRecycleThread.o CRunningThread.o CTaskQueue.o CTask.o CTcpTask.o CTcpTaskPool.o CThread.o CMisk.o Log.o DyByteBuff.o DyByteBuffTest.o StcByteBuff.o Socket.o SocketTest.o MsgQueueTest.o MainTest.o
SOURCESCXX = $(OBJS:%.o=%.cc)
DEPS = $(OBJS:%.o=.%.d)
ALL_TARGETS = execute

RM = rm -rf

all: $(ALL_TARGETS) $(TEST_SOCKET_SERVER) $(TEST_SOCKET_CLIENT)

include $(DEPS)
$(DEPS): .%.d: %.cc
	@$(CXX) -M $(CXXFLAGS) -Wall $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$

$(OBJS): %.o: %.cc
	$(CXX) -c $(CXXFLAGS) $< -o $@

$(ALL_TARGETS): $(OBJS)
	$(CXX) $(OBJS) -o $@ $(CXXLFLAGS)

clean:
	@rm -rf $(OBJS) $(ALL_TARGETS) $(DEPS)

ctags:
	ctags -R *
